package me.feng.dao.impl

import org.hibernate.Session
import org.hibernate.Query

class BaseDao(session:Session) {

  def getFirst(q:Query):Any ={
    if(q.list().size()>0) q.list().get(0) else null
  }
  
  def save[T](o:T):T = {
    session.save(o).asInstanceOf[T]
  }
}